package kr.pe.johnkim.pushchat.mobile.service;

import kr.pe.johnkim.pushchat.mobile.dao.PushChatRecognitionDao;
import kr.pe.johnkim.pushchat.mobile.domain.PushChatRecognition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author : John_Kim <cale9797@gmail.com>
 * @date : 13. 6. 26.
 */
@Service
public class PushChatRecognitionServiceImpl implements PushChatRecognitionService {

    // SLF4J Logging
    private Logger logger = LoggerFactory.getLogger(PushChatRecognitionServiceImpl.class);

    @Autowired
    private PushChatRecognitionDao pushChatRecognitionDao;

    /**
     * 채팅방 인지 테이블에 등록 한다.
     *
     * @param pushChatRecognition
     */
    @Override
    public void registerRecognition(PushChatRecognition pushChatRecognition) {
        logger.info("registerRecognition");
        this.pushChatRecognitionDao.registerRecognition(pushChatRecognition);
    }

    /**
     * 인지 테이블에 등록되어 있는지 확인 한다.
     *
     * @param pushChatRecognition
     * @return
     */
    @Override
    public PushChatRecognition selectDuplicationRecognition(PushChatRecognition pushChatRecognition) {
        logger.info("selectDuplicationRecognition");
        return this.pushChatRecognitionDao.selectDuplicationRecognition(pushChatRecognition);
    }

    /**
     * 인지 테이블의 메시지 읽음 여부를 업데이트 한다.
     *
     * @param pushChatRecognition
     */
    @Override
    public void updateReadYn(PushChatRecognition pushChatRecognition) {
        logger.info("updateReadYn");
        this.pushChatRecognitionDao.updateReadYn(pushChatRecognition);
    }

    /**
     * 인지 테이블의 사용자 정보를 가져 온다.
     *
     * @param pushChatRecognition
     * @return
     */
    @Override
    public PushChatRecognition selectRecognitionInformation(PushChatRecognition pushChatRecognition) {
        logger.info("selectRecognitionInformation");
        return this.pushChatRecognitionDao.selectRecognitionInformation(pushChatRecognition);
    }

    /**
     * 인지 테이블의 사용자 목록을 가져 온다.
     *
     * @param pushChatRecognition
     * @return
     */
    @Override
    public List<PushChatRecognition> selectRecognitionList(PushChatRecognition pushChatRecognition) {
        logger.info("selectRecognitionList");
        return this.pushChatRecognitionDao.selectRecognitionList(pushChatRecognition);
    }
}
